import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {ErrorComponent} from './error/error.component';
import {PreloadSelectedModules} from './preload/preload.module';

const routes: Routes = [
  // {path: '', redirectTo: 'layout', pathMatch: 'full'},
  {path: '', loadChildren: './layout/layout.module#LayoutModule', data: {preload: true}},
  {path: 'error', component: ErrorComponent},
  {path: '**', component: ErrorComponent},
];

@NgModule({
  imports: [RouterModule.forRoot(routes, {preloadingStrategy: PreloadSelectedModules})],
  exports: [RouterModule],
  providers: [PreloadSelectedModules]
})
export class AppRoutingModule { }
